<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/mainstyle.css"/>
	<link rel="stylesheet" href="./css/themes/base/jquery.ui.all.css">
	<script src="./js/jquery-1.6.2.min.js"></script>
	<script src="./js/external/jquery.bgiframe-2.1.2.js"></script>
	<script src="./js/ui/jquery.ui.core.js"></script>
	<script src="./js/ui/jquery.ui.widget.js"></script>
	<script src="./js/ui/jquery.ui.mouse.js"></script>
	<script src="./js/ui/jquery.ui.button.js"></script>
	<script src="./js/ui/jquery.ui.draggable.js"></script>
	<script src="./js/ui/jquery.ui.position.js"></script>
	<script src="./js/ui/jquery.ui.resizable.js"></script>
	<script src="./js/ui/jquery.ui.dialog.js"></script>
  <script src="./js/ui/jquery.ui.datepicker.js"></script>    
    <link rel="stylesheet" href="./css/demos.css">
<title>用户彩铃列表</title>
</head>

<script>
  $(document).bind("contextmenu",function(e){
    return false;
  });

//页码导航 
function post_list(index,curpage,maxpage)
{ 
     if ( parseInt(index) <= parseInt(maxpage) && parseInt(index) > 0  && parseInt(curpage)!=parseInt(index) )
	 {
        document.form1.action = '?action=music_list&curpage='+index+'&agent_id=<% $agent_id %>&musiconhold_id=<% $musiconhold_id %>'; 
	    document.form1.submit(); 
	    return true;
	 }
	 return false;
}
	function goback(old_curpage,agent_id)
	{
		var gotourl = '?action=list&curpage='+old_curpage+'&agent_id='+agent_id ; 
		//alert(gotourl);
	    document.form1.action = gotourl;
	
		document.form1.submit();
	}	
	
	function delete_confirm()
	{
		if (confirm("确定要删除这个文件吗?"))  {
			 return true;	
		}
		return false;	
	}
</script>
<body>
<div id='container'>
 <form name="form1" method="post" action="?action=list&id=<% $gateway.id %>">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                
                <td width="97%" valign="bottom"><span class="table_caption">彩铃文件管理&nbsp;&nbsp;
             <a  href="#"  onClick="goback('<% $old_curpage %>','<% $agent_id %>')" > 返回 </a></span></td>
              </tr>
            </table></td>
            <td><div align="right"><span class="table_caption">
            <img src="images/add.gif" width="10" height="10" /> <a  href="#"  onClick="call_add()" > 添加彩铃 </a>
            
             </span>
             </div></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
 <tr>
                          <td width="2%"  height="24"   bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">序号</div></td>
                          <td width="4%"  height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">彩铃组</div></td>
                          <td width="10%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">彩铃文件名</div></td>
                          <td width="6%"  height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">建立时间</div></td>
                          <td width="6%"  height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">操作</div></td>
          

        </tr>     

          
          
          <% foreach from=$table_array item=eachone key=keyname %>  	
                  <tr>
        
   <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.check_id %></div></td>
    <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $musiconhold_name %></div></td>
    <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.description %></div></td>
    <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.createtime %></div></td>
    <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><a href="?action=music_delete_post&id=<% $eachone.decode_id %>&curpage=<% $curpage %>&old_curpage=<% $old_curpage %>&musiconhold_id=<% $musiconhold_id %>&agent_id=<% $agent_id %>"  onClick="return delete_confirm()" >删除</a></div></td>
        
   
  </tr>
          
 
        <% /foreach %>
    </table></td>
  </tr>
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left"><span class="STYLE21">共
              <% $record_count %>
              条记录，当前第
              <% $curpage %>
              /
              <% $maxpage %>
              页，每页
              <% $pagelimtcount %>
          条记录</span></div></td>
        <td width="67%"><table width="180" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('1','<% $curpage %>', '<% $maxpage %>')"  >首页</a> </div></td>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('<% $curpage-1 %>',   '<% $curpage %>' , '<% $maxpage %>')" >上一页</a></div></td>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('<% $curpage+1 %>',   '<% $curpage %>' , '<% $maxpage %>')" >下一页</a></div></td>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('<% $maxpage  %>',    '<% $curpage %>' , '<% $maxpage %>')" >尾页</a></div></td>
           
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</div>
<div class="demo" >
<div id="dialog-form" title="彩铃文件选择">
	<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c0de98" ">
  
          <tr>
            <td height="20" colspan="2" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr>
            <td height="20" colspan="2" bgcolor="#FFFFFF"><div align="center"><span class="STYLE2 STYLE1">彩铃文件名</span>
            </div></td>
            </tr>
        
          <tr>
            <td height="20" align="right" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">请选择</span><span class="STYLE4">
              <select size="1" name="wav_file_id"  id="wav_file_id"  >
                <% foreach from=$wav_list item=eachone key=keyname %>
                <option value="<% $eachone.decode_id %>"   >   <% $eachone.description %>
                </option>
                <%/foreach%>
              </select>
            </span></div></td>
          </tr>
          <tr>
            <td height="20" align="right" bgcolor="#FFFFFF"><form name="form2" method="post" action="">
              <input name="musiconhold_id" type="hidden" id="musiconhold_id" value="<% $musiconhold_id %>">
            </form></td>
          </tr>
          <tr>
            <td height="20" colspan="2" align="center" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
          <tr>
            <td height="20" colspan="2" align="center" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
       
     
        </table>
 </div>
</div><!-- End demo -->

<script>


function add_submit(post_url)
{
   document.form2.action =    post_url;
	//alert(document.form1.action);			 
	document.form2.submit(); 
	return true;	

}

 function call_add()
 {
    $( "#dialog-form" ).dialog( "open" );

 }
  


$(function() {
    /* form start*/
		$( "#dialog-form" ).dialog({
			autoOpen: false,
			height: 250,
			width: 450,
			modal: true,
			buttons: {
			" 确认提交 ": function() {
                   var wav_file_id = $( "#wav_file_id" );
       			   var post_url = 'musiconhold.php?action=music_add_post&&curpage=<% $curpage %>&old_curpage=<% $old_curpage %>&musiconhold_id=<% $musiconhold_id %>&agent_id=<% $agent_id %>&wav_file_id='+wav_file_id.val();
						add_submit(post_url);
                  $( "#dialog-form" ).dialog( "close" );
				},
			 关闭: function() {
					$( this ).dialog( "close" );
                   
				}
			},
			close: function() {
     			
			}
		});
    /* form end */  
         

         

		/*编辑框选择后显示获取焦点，批量修改窗体提示不修改*/
		 $("input:text,input:password,textarea").focus(function(){
			 $(this).css("background","#CBFE9F");
			 }).blur(function(){
				 $(this).css("background","#FFF");
			 }); 
	});
	</script>
</body>
</html>
